<!DOCTYPE html>
<html lang="zh"  xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>修改医生信息</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">
    <link rel="stylesheet" href="/static/layui/css/layui.css" media="all"/>
    <link rel="stylesheet" href="/static/css/public.css" media="all" />
    <link rel="stylesheet" href="/static/css/repair.css" media="all" />
</head>
<body class="childrenBody">
<form class="layui-form layui-row layui-col-space10">
    <div class="layui-col-md4 layui-col-md-offset4 layui-col-xs12">
        <div class="layui-row layui-col-space10">
            <div class="layui-col-md12 layui-col-xs7">
                <div class="layui-form-item magt3">
                    <label class="layui-form-label"><span class="required">*</span>姓名</label>
                    <div class="layui-input-block">
                        <input type="text" class="layui-input docName" AUTOCOMPLETE="off" name="docName" lay-verify="required" placeholder="请输入医生姓名">
                        <input type="hidden" class="id" name="id">
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div class="layui-col-md4 layui-col-md-offset4 layui-col-xs12">
        <div class="layui-row layui-col-space10">
            <div class="layui-col-md12 layui-col-xs7">
                <div class="layui-form-item magt3">
                    <label class="layui-form-label"><span class="required">*</span>性别</label>
                    <div class="layui-input-block ">
                        <input type="radio" class="layui-input docSex"checked  AUTOCOMPLETE="off" name="docSex"    value="男" title="男" >
                        <input type="radio" class="layui-input docSex" AUTOCOMPLETE="off" name="docSex"  value="女" title="女" >
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div class="layui-col-md4 layui-col-md-offset4 layui-col-xs12">
        <div class="layui-row layui-col-space10">
            <div class="layui-col-md12 layui-col-xs7">
                <div class="layui-form-item magt3">
                    <label class="layui-form-label"><span class="required">*</span>联系方式</label>
                    <div class="layui-input-block">
                        <input type="text" class="layui-input docTel" name="docTel" AUTOCOMPLETE="off" lay-verify="required|phone" placeholder="请输入该医生的手机号码">
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div class="layui-col-md4 layui-col-md-offset4 layui-col-xs12">
        <div class="layui-row layui-col-space10">
            <div class="layui-col-md12 layui-col-xs7">
                <div class="layui-form-item magt3">
                    <label class="layui-form-label"><span class="required">*</span>出生年月</label>
                    <div class="layui-input-block">
                        <input  class="layui-input docDate" name="docDate" id="docDate" />
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div class="layui-col-md4 layui-col-md-offset4 layui-col-xs12">
        <div class="layui-row layui-col-space10">
            <div class="layui-col-md12 layui-col-xs7">
                <div class="layui-form-item magt3">
                    <label class="layui-form-label"><span class="required">*</span>职称</label>
                    <div class="layui-input-block">
                        <input type="text" class="layui-input docTitle" name="docTitle" AUTOCOMPLETE="off" lay-verify="required" placeholder="请输入该医生的职称">
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div class="layui-col-md4 layui-col-md-offset4 layui-col-xs12">
        <div class="layui-row layui-col-space10">
            <div class="layui-col-md12 layui-col-xs7">
                <div class="layui-form-item magt3">
                    <label class="layui-form-label"><span class="required">*</span>初始密码</label>
                    <div class="layui-input-block">
                        <input type="password" class="layui-input docPassword" name="docPassword" AUTOCOMPLETE="off" lay-verify="required" placeholder="请为该医生初始化密码">
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div class="layui-col-md4 layui-col-md-offset4 layui-col-xs12">
        <div class="layui-row layui-col-space10">
            <div class="layui-col-md12 layui-col-xs7">
                <div class="layui-form-item magt3">
                    <div class="layui-input-block">
                        <a class="layui-btn layui-btn-sm" lay-filter="updateDoctor" lay-submit><i class="layui-icon">&#xe605;</i>修改</a>
                    </div>
                </div>
            </div>
        </div>
    </div>
</form>
<script type="text/javascript" src="../../layui/layui.js"></script>
<script>
    layui.use(['form','jquery','element','laydate'],function () {
        var form = layui.form,
            $ = layui.jquery,
            element = layui.element,
            laydate = layui.laydate

        laydate.render({
            elem:'#docDate'
        });


        form.on('submit(updateDoctor)',function (obj) {
            var index = top.layer.msg('数据修改中，请稍候', {icon: 16, time: false, shade: 0.8});
            var data = obj.field;
            console.log(data);

            /**
             * 请求后台
             */
            $.ajax({
                type:'POST',
                url:'/admin/updateDoctor',
                data:JSON.stringify(data),
                dataType:'json',
                contentType:'application/json',
                success:function (res) {
                    /**
                     * 添加成功后回调
                     **/
                    setTimeout(function(){
                        top.layer.close(index);
                        top.layer.msg("修改成功！");
                        layer.closeAll("iframe");
                        //刷新父页面
                        parent.location.reload();
                    },500);
                    return false;
                }
            });
        })
    });


</script>